home *** CD-ROM | disk | FTP | other *** search
- on BinarySearch artName
- global gArtLib
- set ArtStart to 1
- set ArtEnd to 306
- set ArtLib to gArtLib
- set bFound to 0
- set bMissing to 0
- set chkCount to 0
- repeat while not bFound and not bMissing
- set midPt to (ArtStart + ArtEnd) / 2
- put midPt & "..."
- set chkMem to the name of member midPt of castLib ArtLib
- set bFound to artName = chkMem
- put artName & "=" & chkMem & " is " & bFound
- set chkCount to chkCount + 1
- if not bFound then
- if ArtStart >= ArtEnd then
- set bMissing to 1
- end if
- if artName < chkMem then
- set ArtEnd to midPt - 1
- next repeat
- end if
- set ArtStart to midPt + 1
- end if
- end repeat
- if bMissing then
- return 0
- else
- put "returnval = " & midPt
- return midPt
- end if
- end
-